<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arr=['Trupm','biden','jerry','Tom','xiaoai'];
            
            var length=arr.length
            console.log(length);
            //数组的后面添加一条数据
            arr[arr.length]='附加值'
            console.log(arr[5]);
            
            //赋值的数大于数组的长度,后面多余位置为空，取值多余的位置为undefined
            arr.length=10;
            console.log(arr,arr[8]);
            
            //赋值的数小于数组的真实长度，删除掉后面多余的数据
            arr.length=2;
            console.log(arr,arr[5]);
    </script>
</head>
<body>
    
</body>
</html>